﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace ZenSystemService.Api.Migrations
{
    /// <inheritdoc />
    public partial class SalesOrderItemProductId : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_InstitutionSalesOrderItems_DeviceTypes_DeviceTypeId",
                table: "InstitutionSalesOrderItems");

            migrationBuilder.DropIndex(
                name: "IX_InstitutionSalesOrderItems_DeviceTypeId",
                table: "InstitutionSalesOrderItems");

            migrationBuilder.RenameColumn(
                name: "DeviceTypeId",
                table: "InstitutionSalesOrderItems",
                newName: "ProductId");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.RenameColumn(
                name: "ProductId",
                table: "InstitutionSalesOrderItems",
                newName: "DeviceTypeId");

            migrationBuilder.CreateIndex(
                name: "IX_InstitutionSalesOrderItems_DeviceTypeId",
                table: "InstitutionSalesOrderItems",
                column: "DeviceTypeId");

            migrationBuilder.AddForeignKey(
                name: "FK_InstitutionSalesOrderItems_DeviceTypes_DeviceTypeId",
                table: "InstitutionSalesOrderItems",
                column: "DeviceTypeId",
                principalTable: "DeviceTypes",
                principalColumn: "DeviceTypeId",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
